/**
 * 
 */
package com.idea.auction.controller;


import org.apache.log4j.Logger;
import org.apache.shiro.authz.annotation.RequiresPermissions;

import com.idea.auction.service.LogService;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.kit.StrKit;
import com.jfinal.server.Service;

/**
 * @author y.z
 */
@ControllerBind(controllerKey="/log",viewPath="/pages")
public class LogController extends BaseController{
	private static final Logger log = Logger.getLogger(LogController.class);
	@Service
	private LogService logService;
	
	/**
	 * 系统日志
	 */
	@RequiresPermissions("log/toSysLog")
	public void toSysLog(){
		getNavigation();
		render("systemlog/log-list.html");
	}
	
	
	/**
	 * 日志列表
	 */
	
	public void getLogList(){
		System.out.println(getPara("curPage"));
		if(!StrKit.isBlank(getPara("curPage"))){
			curPage = getParaToInt("curPage");
		}
		super.setPage(logService.getPage(curPage,this.getPara("startDate"), this.getPara("endDate"), null));
		
		
	}
	
	/**
	 * 删除日志
	 */
	public void delLogs(){
		String ids = getPara("ids");
		String idArray[] = ids.split(",");
		
		for(String id:idArray){
			logService.delete(Integer.parseInt(id));
		}
		
		msgSuccess();
	}
}
